package com.fangzhi.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fangzhi.mobel.ProductTechnology;
import com.fangzhi.mobel.vo.TechnologyListVo;
import com.fangzhi.service.ProductTechnologyService;
import com.fangzhi.mapper.ProductTechnologyMapper;
import com.fangzhi.utils.BeanCopyUtil;
import com.fangzhi.utils.ResponseResult;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* @author edy
* @description 针对表【product_technology】的数据库操作Service实现
* @createDate 2024-09-24 19:14:47
*/
@Service
public class ProductTechnologyServiceImpl extends ServiceImpl<ProductTechnologyMapper, ProductTechnology>
    implements ProductTechnologyService{

    @Override
    public ResponseResult technologyList() {
        List<ProductTechnology> list = this.list(Wrappers.<ProductTechnology>lambdaQuery()
                .eq(ProductTechnology::getStatus, 1));
        List<TechnologyListVo> collect = list.stream().map(T -> new TechnologyListVo().setId(T.getId())
                .setName(T.getName()).setPrice(T.getPrice())).collect(Collectors.toList());
        return ResponseResult.OK(collect);
    }
}




